function create_n_deploy_vmconnect_script (
	[int] $scenario,  #scenario 0..#s-1
	[int] $computer #ordinateur 0..#c-1
) { 
	$VMServer = $CONFIG_SERVERS[$computer]
	$sujet = $sujets[$scenario]
	
	
	$tmp_dir = ((Get-ChildItem Env:TEMP).value+"\")
	$script_name = "start.bat"
	$programfiles = ((Get-ChildItem Env:PROGRAMFILES).value+"\")
	$vmconnect = ($programfiles+"Hyper-V\vmconnect.exe")
	
		#effacement ancien script
			if(Test-Path ($tmp_dir+$s2cript_name)) {
				Remove-Item -force ($tmp_dir+$script_name)
			}
		
		# creation du script
			$str = ""
			if($sujet.vmconnect) {
				$arr = $sujet.vmconnect
			} else {
				$arr = New-Object System.Collections.ArrayList;
				foreach($vm in $sujet.vms) {
					Insert($arr.Count,$vm.name);
				}
			}
			foreach($vmshortname in $arr) {
				$str += ("start "+[char]34+"title"+[char]34+" /MAX "+[char]34+$vmconnect+[char]34+" "+[char]34+$VMServer+[char]34+" "+[char]34+$sujet.scenario_name+"-"+$vmshortname+[char]34+" `n ")
			}
			$str | out-file -encoding ascii ($tmp_dir+$script_name)
		
		#test
		#$VMServer = "fabinou"
		#$VMCONNECT_SCRIPT_DIR="\c$\"
		
		# copie sur le bureau
			robocopy $tmp_dir \\$VMServer$VMCONNECT_SCRIPT_DIR $script_name
}

$actions.Insert($actions.Count,"create_n_deploy_vmconnect_script");
set-variable LANG_ACTION__CREATE_N_DEPLOY_VMCONNECT_SCRIPT "CREER et DEPLOYER les scripts de VMCONNECT" -scope global